<template>
	<view class="xp24-32 xbs">


		
		<view class="info xmt24 xbgcf xpt24 xpl24 xpr24 ">
			<view class="info-label xfz30 xc3 xfw500">上传凭证<text class="xc90 xfz28 xml12">（请上传号凭证）</text></view>
			<view class="xmt12">
				<u-upload :fileList="fileList" @afterRead="afterRead" @delete="deletePic" name="1" multiple
					:maxCount="1" :size="44" activeColor="#ff8b0d"></u-upload>
			</view>
		</view>


		<u-datetime-picker :show="show" v-model="value1" mode="datetime" @confirm="confirm"></u-datetime-picker>


		<view class="btn xmt60" @click="getAddExpressc()">提交</view>
	</view>
</template>

<script setup>
	import {
		onReachBottom,
		onShow,
		onLoad
	} from '@dcloudio/uni-app';
	import {
		reactive,
		ref
	} from "vue"

	import upload from '@/hooks/upload.js'

	import {orderupload} from "@/network/home.js"

	const {
		deletePic,
		afterRead,
		fileList
	} = upload()


	// 表单数据

	let form = reactive({
		id: '',
		paytime:'',
		images: [],
		
	})

	let value1 = ref(Number(new Date()))
	
	let show = ref(false)
	
	const confirm = (e) =>{
		
		form.paytime = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM:ss') 
		show.value = false
	}

	const getAddExpressc = () => {
		console.log(fileList.value);
		let images = fileList.value.map(item => item.urls)
		orderupload({
			id:form.id,
			uploadimage:images
		}).then(res => {
			console.log(res);
			uni.showToast({
				title: '提交成功',
				icon: 'none'
			})
			setTimeout(() => {
				uni.navigateBack()
			}, 1000)
		})
	}

	onLoad((options) => {
		form.id = options.id
	})
</script>

<style>
	::v-deep .u-textarea {
		background-color: none !important;
		border-style: none !important;
	}

	::v-deep .u-textarea__count {
		background-color: transparent !important;
	}
</style>
<style lang="scss" scoped>
	page {
		background-color: #F9F9F9;
	}
</style>
<style scoped lang="scss">
	.info {
		&-money {
			color: #E91A19;
		}

		&-sicon {
			width: 32rpx;
			height: 32rpx;
		}

	}

	.color1 {
		color: #E91A19;
	}

	.color2 {
		color: #FF8B11;
	}

	.lih {
		line-height: 40rpx;
	}

	.btn {
		width: 686rpx;
		height: 80rpx;
		background: #CDA26C;
		border-radius: 40rpx;
		font-size: 28rpx;
		font-weight: 500;
		color: #FFFFFF;
		line-height: 80rpx;
		text-align: center;
	}
</style>